home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Games / NeXTmj / Source / TileCountManager.h < prev    next >
C/C++ Source or Header  |  1991-03-17  |  2KB  |  75 lines

  1.  
  2. /*
  3.  * This object is the heart of the game.
  4.  *    Many of the standard GUI interface calls pass 
  5.  *    through a translation object and forwarded to this object.
  6.  *
  7.  * This is a rather large object.  It has to coordinate many
  8.  *    functions.
  9.  *
  10.  $Author$
  11.  $Header$
  12.  *
  13.  $Log$
  14.  */
  15.  
  16. #import    "NumberTileArray.h"
  17.  
  18. extern "Objective-C" {
  19. #import    "TileCountView.h"
  20. }
  21.  
  22.  
  23. class TileCountManager {
  24. private:
  25.                                                 // This is a view which displays the
  26.                                                 //    number of tiles remaining on the
  27.                                                 //    Game Board.  It is passed in the 
  28.                                                 //    constructor.  
  29.                                                 // Whenever the tile count changes the
  30.                                                 //    view is marked as needs display.
  31.                                                 // When a drawImage() is received from the
  32.                                                 //    interface object (by virtue of the view
  33.                                                 //    receiving a drawSelf:: method) the 
  34.                                                 //    number tiles are composited on this 
  35.                                                 //    view.
  36.     TileCountView*            my_view;
  37. public:
  38.                                                 // This method comes from the interface
  39.                                                 //    object and from there the Game Board's
  40.                                                 //    view.  It is called when the view
  41.                                                 //    receives a drawSelf:: method.
  42.     void                    drawImage( void );
  43.                         
  44. private:
  45.     NumberTileArray            number_array;
  46.  
  47. private:
  48.                                                 // This variable holds the number of
  49.                                                 //    peices not removed from the game
  50.                                                 //    board.
  51.     int                        count_value;
  52.                                                 // This method updates the view with
  53.                                                 //    the current count.
  54.     void                    updateView( void );
  55. public:
  56.                                                 // This method reset's the count to 144.
  57.     void                    resetCount( void ),
  58.                                                 // This method adds to the current
  59.                                                 //    count.
  60.                             addTwo( void ),
  61.                                                 // This method subtracts two from the
  62.                                                 //    current count.
  63.                             subtractTwo( void );
  64.                                                 // This method returns the current count.
  65.     int                        count( void );
  66.                                                 // This method tests to determine if the
  67.                                                 //    Game Board is empty.
  68.     BOOL                    isEmpty( void );
  69.  
  70. public:
  71.     TileCountManager( TileCountView* );
  72.  
  73. };
  74.  
  75.